$$ = window.$$
litxt = "name 量 原价 现价"
clsli = "_3d62XhmxqZ2aqaKNGiIIj1 _1k6wuLx8UcMSxt2SLZ9PsO _1W48OExr-k2whjJwNO0MWP _3rE20XmTwcUpTaMs1iEU06".split(" ")

li = litxt.split(" ")
out = [li.join(",")]
exist = new Set()

dump = =>
  new Promise (resolve)=>
    setTimeout(
      =>
        for i from $$("dd[data-tag=spu]")
          t = []
          for cls from clsli
            t.push((i.getElementsByClassName(cls)[0]?.innerText or '').replace(/,/g,"，"))
          name = t[0]

          if exist.has name
            continue
          exist.add name

          if t[1]
            t[3] = t[3].split(t[1])[0]
            if t[1].startsWith '/'
              t[1] = t[1].slice(1)

          out.push t.join(',')
        resolve()
      5000
    )

do =>
  for i from $$('._2-FcnF1vko1vJVoERRu2zs')
    i.click()
    await dump()
  console.log out.join("\n")
  console.log out.length





